<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\LinkPager;

?>

<!-- topbar ends -->
<div class="row">
    <div class="container lh30">
        <a class="topNav"  href="<?=Url::toRoute('/system/site/index')?>"><img src="<?=Yii::getAlias('@web/backend/img/home/home.png');?>" alt="首页"/>返回首页</a>
    </div>
</div>

<div class="row nav-brand-bg">
    <div class="container lh30">
        <ul class="nav nav-tabs">
            <li><a href="<?=Url::toRoute('shop/index')?>">线上店铺</a></li>
            <li class="active"><a href="<?=Url::toRoute('shop/servicelist')?>">线上项目</a></li>
        </ul>
    </div>
</div>
<div class="container">
    <div class="lh45 mt20">
        <form class="" role="form" action="" method="get">
            <span class="mr10">项目名称</span>
            <input class="lh45" type="text" name="service_name" value="<?=$service_name ?>"/>
            <span class="mg20-x">状态</span>
            <div class="select lh45">
                    <select class="form-control" name="type" id="">
                        <option value="-10000" <?php if($type == -10000){?>selected="selected"<?php }?>>全部</option>
                        <option value="1" <?php if($type == 1){?>selected="selected"<?php }?>>上架</option>
                        <option value="-1" <?php if($type == -1){?>selected="selected"<?php }?>>下架</option>
                    </select>
                </div>
            <a class="btnBg ml20" style="width: 75px; color: #fff;border-radius: 6px; height: 45px;">
                <input type="submit" value="搜索" style="display: block; width: 100%; background: 0;border:0;line-height: 45px; font-size: 17px;">
            </a>
        </form>
    </div>

    <a class="btnBg mg20-y text-right" href="<?=Url::toRoute(['shop/serviceadd'])?>"><img src="<?=Yii::getAlias('@web/backend/img/onlineshop/add_button.png');?>" style="margin-right: 35px;vertical-align: middle;">添加项目</a>

    <?php if(empty($data)){?>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>项目名称</th>
            <th>价格</th>
            <th>状态</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td colspan="6" align="center"><img src="<?=Yii::getAlias('@web/backend/img/nodata.gif');?>"></td>
        </tr>
        </tbody>
    </table>
    <?php }else{?>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>项目名称</th>
            <th>价格</th>
            <th>状态</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <?php foreach ($data as $v){?>
        <tr>
            <td><?= Html::encode($v['id'])?></td>
            <td><?= Html::encode($v['name'])?></td>
            <td><?= Html::encode($v['price'])?></td>
            <td>
                <?php if($v['is_sell'] == 1){?>
                                                     上架
                <?php }?>
                <?php if($v['is_sell'] == -1){?>
                                                     下架
                <?php }?>
            </td>
            <td><?= Html::encode($v['addtime'])?></td>
            <td>
                <a class="red mr20  btn btn-sm btn-borB4" href="<?=Url::toRoute(['shop/serviceedit','id' => $v['id']]) ?>">编辑</a>
                <?php if($v['is_sell'] == 1){?>
                    <a class="red mr20 btn btn-sm btn-borB4" href="<?=Url::toRoute(['shop/setstate','id' => $v['id'],'is_sell' => -1]) ?>">下架</a>
                <?php }?>
                <?php if($v['is_sell'] == -1){?>
                    <a class="red mr20 btn btn-sm btn-borB4" href="<?=Url::toRoute(['shop/setstate','id' => $v['id'],'is_sell' => 1]) ?>">上架</a>
                <?php }?>
                
            </td>
        </tr>
        <?php }?>
        </tbody>
    </table>
    <?php }?>
</div>
<div class="page">
        <?=LinkPager::widget([
            'pagination' => $page,
	       'firstPageLabel' => '首页',
	       'nextPageLabel' => '下一页',
	       'prevPageLabel' => '上一页',
	       'lastPageLabel' => '末页',
        ]); ?>
</div>







